package com.twenty.seven.apollo.demo.netty;

import java.io.IOException;
import java.io.InputStream;
import java.net.ServerSocket;
import java.net.Socket;

public class SelvenSocketServer {

    public static void main(String[] args) throws IOException {
        ServerSocket serverSocket = new ServerSocket(9999);
        //获取新链接
        while(true){
            final Socket accept = serverSocket.accept();
            InputStream inputStream = accept.getInputStream();
            while (true){
                byte[] request = new byte[1024];
                int read = inputStream.read(request);
                if(read == -1){
                    break;
                }

                String content = new String(request);
                System.out.println(content);
            }
        }
    }
}
